﻿using System.Linq;
using PersonaLibrary.Data;

namespace PersonaLibrary.ViewModel.JobViewModel
{
    public class JobViewModel : LinqEditableItem<Job, View.SimplyView.SimplyNameView>
    {
        public JobViewModel()
        {
            EditableItem = new Job();
        }

        public JobViewModel(int id)
        {
            EditableItem = Context.Jobs.Single(x => ((Job)x).Id == id);
        }

        public override bool CanCommit()
        {
            return !(string.IsNullOrEmpty(EditableItem.Name));
        }
    }
}
